import Vue from "vue";
import axios from "axios";
import VueAxios from "vue-axios"
import {Message,Notification} from "element-ui"
Vue.use(VueAxios,axios)
axios.defaults.baseURL="http://localhost:9090"
axios.interceptors.response.use(
  (res)=>{
    return res;
  },
  (error)=>{
    if (error && error.response){
      switch (error.response.status){
        case 1024:{
          Message.error(JSON.stringify(error.response.data)+"前端补充")
          break;
        }
        case 930:{
          Message.error(JSON.stringify(error.response.data))

        }
        // eslint-disable-next-line no-fallthrough
        default :{
          Message.error(JSON.stringify(error.response.data))
          break;

        }

      }
      //正常的走下去
      //return undefined;
      throw error;
      //return Promise.reject(error);
    }
  },
)
